class Game extends egret.DisplayObjectContainer {
	private video;
	private msg:Mediator=Mediator.getInstance();
	public constructor() {
		super();
		this.video = new egret.Video();
        this.video.x = 0;                       //设置视频坐标x
        this.video.y = 0;                       //设置视频坐标y
        this.video.width = 640;                 //设置视频宽
        this.video.height = 1136;                //设置视频高
        this.video.fullscreen = true;          //设置是否全屏（暂不支持移动设备）
        this.video.load("resource/assets/test.mp4");
        this.addChild(this.video);              //将视频添加到舞台

		//监听视频加载完成
        this.video.once(egret.Event.COMPLETE,this.onLoad,this);
        //监听视频加载失败
        this.video.once(egret.IOErrorEvent.IO_ERROR,this.onLoadErr,this);
	}
	private onLoad(e: egret.Event) {
		this.msg.dispatchEvent(new MediatorEvent('VideoLoaded'));
		// this.video.play();
    }
    private onLoadErr(e: egret.Event) {
        console.log("video load error happened");
    }
    public play() {
        this.video.play();
    }
}